package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.busi.service.live.GiftService;
import com.cssw.fyzb.core.model.dodb.CmfGift;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import com.ydn.dbframe.plugin.activerecord.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 获取礼物列表
 * @author wondream
 */
@Function(description = "获取礼物列表")
@Component
public class ListGift implements Action {

    @Autowired
    GiftService giftService;

    @Override
    public Response execute(Request request) throws Exception {
        Page<CmfGift> page = giftService.listGift(1, 20);
        return Response.success().put("list", page.getList()).put("total", page.getTotalPage()).put("count", page.getTotalRow());
    }
}
